﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Module_FormDangKy : PanelControl
{
    UserBusiness ub = new UserBusiness();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnResg_Click(object sender, EventArgs e)
    {
        string[] values = { txtUserName.Text,Helper.EncodePass(txtPass.Text),txtFullName.Text,txtBirthDay.Text,rdoMale.Checked?"1":"0",txtEmail.Text,
                          txtAddress.Text,txtPhoneNumber.Text,txtCreditCard.Text,txtCardNumber.Text,"0","2"};
        if (ub.Insert(values))
        {
            UserEntities ue = ub.login(txtUserName.Text, Helper.EncodePass(txtPass.Text));
            Session["user"] = ue;
            Response.Redirect("Default.aspx");
        }
        else
        {
            Label1.Text = "Đăng ký lỗi!!! Vui lòng đăng ký lại";
            txtPass.Text = "";
            txtConfirmPass.Text = "";
        }
    }
    protected void btnCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx");
    }
}